<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p> {{ myMsg }} </p>
        <button @click="clickHandler">修改</button>
    </div>
    <script src="./vue.js"></script>
    <script>
        new Vue({
            el:'#app',
            data() {
                return {
                    msg:"Hello World",
                    age: 18,
                }
            },
            methods: {
                clickHandler() {
                    this.msg = "demo";
                }
            },
            // 计算属性
            computed: {
                myMsg: function() {
                    // 计算属性默认只有getter方法
                    return `我的名字叫${this.msg}, 年龄是${this.age}`;
                }
            }
        });
    </script>
</body>
</html>